#ifndef GAMEOBJECTPOOL_H
#define GAMEOBJECTPOOL_H

#include <QObject>
#include"gamecontrol.h"
#include "gameobject.h"

//对象池

class GameObjectPool : public QObject
{

public:
    GameObjectPool(QObject *parent =nullptr);
    static GameObjectPool* instance;
    static GameObjectPool* Instance()
    {
        if(instance==nullptr)
        {
            return instance =new GameObjectPool;
        }
        return instance;
    }


    //对象池初始化
    void Init();

    //获取对象
    GameObject* GetGameObject(int m_ObgectType);

    //回收对象
    void RecoveryGameObject(GameObject* _object);


    //子弹对象池
    QList<Bullet*> mBulletPool;

    //敌人对象容器
    QList<EnemyMonster*> mEnemyMonsterPool;

    //内存清除
    void Clear();

    ~GameObjectPool();

};

#endif // GAMEOBJECTPOOL_H
